/*
 * Instruction02.java
 *
 * Created on March 21, 2007, 9:58 PM
 *
 */

/*
 
Add one to index register Y. LEAY 1,Y can produce the same result but
LEAY does not affect the Z status bit. Although the LEAY instruction is
more flexible, INY requires only one byte of object code.
INY operation affects only the Z status bit.
 
*/

 package moto9s12sim;

/*
 *
 * @author Fergus Earnshaw
 *
 */

public class Instruction02 extends Instruction {
    
    /** Creates a new instance of Instruction02 */
    public Instruction02()
    {
        this.strAssemblyCode = "INY";
        this.bCodes = new byte[1];
        this.bCodes[0] = (byte)Integer.parseInt("02",16);
    }
    
    public boolean excute(M9S12 cpu)
    {
        this.shAddr = cpu.PC.getRegister();
        //(Y) + $0001 => Y
        cpu.Y.inc();
        cpu.PC.inc();
        
        //FLAGS
        cpu.CC.setZ(cpu.Y.getUnsignedRegister() == 0);
        
        printInstruction(cpu);

        return true;
    }  
    
}
